import React from 'react';
import PropTypes from 'prop-types';
import { observer } from 'mobx-react';
import { WeaDialog } from 'ecCom';

@observer
class SettingDialog extends React.Component {
  static propTypes = {
    title: PropTypes.string.isRequired,
    visible: PropTypes.bool.isRequired,
    onCancel: PropTypes.func.isRequired,
  };

  static defaultProps = {
    style: {},
    btns: [],
  };

  render() {
    return (
      <WeaDialog
        ecId={`${
          (this && this.props && this.props.ecId) || ''
        }_WeaDialog@06yo1a`}
        {...this.props}
        title={this.props.title}
        icon={'icon-coms-email'}
        iconBgcolor="#788f9d"
        visible={this.props.visible}
        className={this.props.className}
        style={this.props.style}
        buttons={this.props.btns}
        onCancel={this.props.onCancel}
        moreBtn={{
          // 这边先给个假的data，因为他自定义的组件封装太死，要改的话每个调用处自己重新加
          datas: this.props.btn,
        }}
      >
        {this.props.children}
      </WeaDialog>
    );
  }
}

export default SettingDialog;
